Socket
Socket
Sign inDemoInstall

hypercore-promisifier

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypercore-promisifier

A Hypercore wrapper that lets you switch between callback and Promise APIs


Version published
Weekly downloads
31
increased by93.75%
Maintainers
1
Weekly downloads
 
Created
Source

hypercore-promisifier

Test on Node.js

A wrapper that provides conversion to/from callback/promise interfaces in Hypercore and RemoteHypercore.

Installation

npm i hypercore-promisifier

Usage

const hypercore = require('hypercore')
const ram = require('random-access-memory')
const { toPromises } = require('hypercore-promisifier')

const core = hypercore(ram)

// A promisified Hypercore interface
const wrapper = toPromises(core)

API

The API supports two methods, each one returning a compatibilty wrapper around Hypercore.

const { toCallbacks, toPromises, unwrap } = require('hypercore-promisifier')

toCallbacks(core) takes a Hypercore-like object with a Promises API, and returns a wrapper with a callbacks interfaced.

toPromises(core) takes a Hypercore-like object with a callbacks API, and returns a wrapper with a Promises interface.

unwrap(core) takes either a wrapper object, or a normal Hypercore, and returns a normal (callbacks API) Hypercore.

License

MIT

Keywords

FAQs

Package last updated on 14 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc